import 'package:shared_preferences/shared_preferences.dart';

class SharedPrefrenceUtil {
  static void setStringValue(String key, String value) async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    sharedPreferences.setString(key, value);
  }

  static Future<String> getStringValue(String key,String value) async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    var t=sharedPreferences.getString(key);
    if(t==null||t.isEmpty){
      return value;
    }
    return t;
  }

  static void setBoolValue(String key,bool value) async{
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    sharedPreferences.setBool(key, value);
  }

  static Future<bool> getBoolValue(String key,bool value) async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    var t=sharedPreferences.getBool(key);
    if(t==null){
      return value;
    }
    return t;
  }

}
